# -*- coding: utf-8 -*-
#
# emof.py
#
#
# PyEMOF: An EMOF support for Python
#
# Copyright (C) 2004, 2007 Raphael Marvie 
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# http://www.fsf.org/licensing/licenses/gpl.html
#
# Author contact: raphael.marvie@lifl.fr
#
# Modified and adapted to conform with ECORE 2.0 by brenomachado@gmail.com


class list_composite(list):

    def __init__(self):
        super(list_composite, self).__init__()

    def append(self, value):
        value.isRoot = False
        super(list_composite, self).append(value)

    def remove(self, value):
        value.isRoot = True
        super(list_composite, self).remove(value)
        


class Element(object):

    _id = 0
    isRoot = True

    def __init__(self, ownedComment=None, tag=None):
        super(Element, self).__init__()
        Element._id += 1
        self._xmi_id = 'Element:%s' % Element._id
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = True
        del self.visited
        return res    
    
    def get_ownedComment(self):
        return self._ownedComment
    def add_ownedComment(self, val):
        self._ownedComment.append(val)
    ownedComment = property(get_ownedComment)
    
    def get_tag(self):
        return self._tag
    def add_tag(self, val):
        self._tag.append(val)
    tag = property(get_tag)
    
    def get_id(self):
        return self._xmi_id
    id = property(get_id)
    
    def getMetaClass(self):
        pass

    def container(self):
        pass

    def equals(self, element):
        pass

    def get(self, property):
        pass

    def set(self, property, element):
        pass

    def isSet(self, property):
        pass

    def unset(self, property):
        pass    


class Comment(Element):
    _id = 0
    isRoot = True

    def __init__(self, body=None, annotatedElement=None, ownedComment=None, tag=None):
        super(Comment, self).__init__()
        Comment._id += 1
        self._xmi_id = 'Comment:%s' % Comment._id
        self._body = body
        if not annotatedElement:
            annotatedElement = list()
        self._annotatedElement = annotatedElement
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None 
        res = True
        del self.visited
        return res    
    
    def get_body(self):
        return self._body
    def set_body(self, value):
        self._body = value
    body = property(get_body, set_body)
    
    def get_annotatedElement(self):
        return self._annotatedElement
    def set_annotatedElement(self, value):
        self._annotatedElement = value
    def add_annotatedElement(self, val):
        self._annotatedElement.append(val)
    annotatedElement = property(get_annotatedElement,set_annotatedElement)
    
class NamedElement(Element):

    _id = 0
    isRoot = True

    def __init__(self, name=None, ownedComment=None, tag=None):
        super(NamedElement, self).__init__()
        NamedElement._id += 1
        self._xmi_id = 'NamedElement:%s' % NamedElement._id
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.name == other.name
        del self.visited
        return res    

    def get_name(self):
        return self._name
    def set_name(self, value):
        self._name = value
    name = property(get_name, set_name)


class Tag(Element):

    _id = 0
    isRoot = True

    def __init__(self, name=None, value=None, element=None, ownedComment=None, tag=None):
        super(Tag, self).__init__()
        Tag._id += 1
        self._xmi_id = 'Tag:%s' % Tag._id
        self._name = name
        self._value = value
        if not element:
            element = list()
        self._element = element
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.name == other.name and self.value == other.value and self.element == other.element
        del self.visited
        return res    

    def get_name(self):
        return self._name
    def set_name(self, value):
        self._name = value
    name = property(get_name, set_name)

    def get_value(self):
        return self._value
    def set_value(self, value):
        self._value = value
    value = property(get_value, set_value)

    def get_element(self):
        return self._element
    def set_element(self, value):
        self._element = value
    def add_element(self, val):
        self._element.append(val)
    element = property(get_element, set_element)


class Package(NamedElement):

    _id = 0
    isRoot = True

    def __init__(self, uri=None, nestedPackage=None, nestingPackage=None, ownedType=None, name=None, ownedComment=None, tag=None):
        super(Package, self).__init__()
        Package._id += 1
        self._xmi_id = 'Package:%s' % Package._id
        self._uri = uri
        if not nestedPackage:
            nestedPackage = list_composite()
        self._nestedPackage = nestedPackage
        self._nestingPackage = nestingPackage
        if not ownedType:
            ownedType = list_composite()
        self._ownedType = ownedType
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.uri == other.uri and self.nestedPackage == other.nestedPackage and self.nestingPackage == other.nestingPackage and self.ownedType == other.ownedType and self.name == other.name
        del self.visited
        return res    

    def get_uri(self):
        return self._uri
    def set_uri(self, value):
        self._uri = value
    uri = property(get_uri, set_uri)

    def get_nestedPackage(self):
        return self._nestedPackage
    def add_nestedPackage(self, value, other=True):
        self._nestedPackage.append(value)
        if other:
            value.set_nestingPackage(self, False)
    def del_nestedPackage(self, value, other=True):
        self._nestedPackage.remove(value)
        if other:
            value.del_nestingPackage(self, False)
    nestedPackage = property(get_nestedPackage)

    def get_nestingPackage(self):
        return self._nestingPackage
    def set_nestingPackage(self, value, other=False):
        self._nestingPackage = value
        if other:
            value.add_nestedPackage(self, False)
    def del_nestingPackage(self, other=True):
        if other and self._nestingPackage:
            self._nestingPackage.del_nestedPackage(self, False)
        self._nestingPackage = None
    nestingPackage = property(get_nestingPackage, set_nestingPackage)

    def get_ownedType(self):
        return self._ownedType
    def add_ownedType(self, val):
        self._ownedType.append(val)
    ownedType = property(get_ownedType)


class TypedElement(NamedElement):

    _id = 0
    isRoot = True

    def __init__(self, type=None, name=None, ownedComment=None, tag=None):
        super(TypedElement, self).__init__()
        TypedElement._id += 1
        self._xmi_id = 'TypedElement:%s' % TypedElement._id
        self._type = type
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.type == other.type and self.name == other.name
        del self.visited
        return res    

    def get_type(self):
        return self._type
    def set_type(self, value):
        self._type = value
    type = property(get_type, set_type)


class EnumerationLiteral(NamedElement):

    _id = 0
    isRoot = True

    def __init__(self, enumeration=None, name=None, ownedComment=None, tag=None):
        super(EnumerationLiteral, self).__init__()
        EnumerationLiteral._id += 1
        self._xmi_id = 'EnumerationLiteral:%s' % EnumerationLiteral._id
        self._enumeration = enumeration
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag
        
    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.enumeration == other.enumeration and self.name == other.name
        del self.visited
        return res    

    def get_enumeration(self):
        return self._enumeration
    def set_enumeration(self, value, other=False):
        self._enumeration = value
        if other:
            value.add_ownedLiteral(self, False)
    def del_enumeration(self, other=True):
        if other and self._enumeration:
            self._enumeration.del_ownedLiteral(self, False)
        self._enumeration = None
    enumeration = property(get_enumeration, set_enumeration)


class Type(NamedElement):

    _id = 0
    isRoot = True

    def __init__(self, name=None, package=None, ownedComment=None, tag=None):
        super(Type, self).__init__()
        Type._id += 1
        self._xmi_id = 'Type:%s' % Type._id
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._package = package
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.name == other.name
        del self.visited
        return res    

    def isInstance(self, element):
        pass
    
    def get_package(self):
        return self._package
    def set_package(self, value):
        self._package = value
    
    package = property(get_package, set_package)

class MultiplicityElement(TypedElement):

    _id = 0
    isRoot = True

    def __init__(self, isOrdered=False, isUnique=False, lower=None, upper=None, type=None, name=None, ownedComment=None, tag=None):
        super(MultiplicityElement, self).__init__()
        MultiplicityElement._id += 1
        self._xmi_id = 'MultiplicityElement:%s' % MultiplicityElement._id
        self._isOrdered = isOrdered
        self._isUnique = isUnique
        self._lower = lower
        self._upper = upper
        self._type = type
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.isOrdered == other.isOrdered and self.isUnique == other.isUnique and self.lower == other.lower and self.upper == other.upper and self.type == other.type and self.name == other.name
        del self.visited
        return res    

    def get_isOrdered(self):
        return self._isOrdered
    def set_isOrdered(self, value):
        self._isOrdered = value
    isOrdered = property(get_isOrdered, set_isOrdered)

    def get_isUnique(self):
        return self._isUnique
    def set_isUnique(self, value):
        self._isUnique = value
    isUnique = property(get_isUnique, set_isUnique)

    def get_lower(self):
        return self._lower
    def set_lower(self, value):
        self._lower = value
    lower = property(get_lower, set_lower)

    def get_upper(self):
        return self._upper
    def set_upper(self, value):
        self._upper = value
    upper = property(get_upper, set_upper)


class DataType(Type):

    _id = 0
    isRoot = True

    def __init__(self, name=None, package=None, ownedComment=None, tag=None):
        super(DataType, self).__init__()
        DataType._id += 1
        self._xmi_id = 'DataType:%s' % DataType._id
        self._package = package
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.name == other.name
        del self.visited
        return res    


class Class(Type):

    _id = 0
    isRoot = True

    def __init__(self, isAbstract=False, ownedAttribute=None, ownedOperation=None, superClass=None, name=None, package=None, ownedComment=None, tag=None):
        super(Class, self).__init__()
        Class._id += 1
        self._xmi_id = 'Class:%s' % Class._id
        self._isAbstract = isAbstract
        if not ownedAttribute:
            ownedAttribute = list_composite()
        self._ownedAttribute = ownedAttribute
        if not ownedOperation:
            ownedOperation = list_composite()
        self._ownedOperation = ownedOperation
        if not superClass:
            superClass = list()
        self._superClass = superClass
        self._name = name
        self._package = package
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.isAbstract == other.isAbstract and self.ownedAttribute == other.ownedAttribute and self.ownedOperation == other.ownedOperation and self.superClass == other.superClass and self.name == other.name
        del self.visited
        return res    

    def get_isAbstract(self):
        return self._isAbstract
    def set_isAbstract(self, value):
        self._isAbstract = value
    isAbstract = property(get_isAbstract, set_isAbstract)

    def get_ownedAttribute(self):
        return self._ownedAttribute
    def add_ownedAttribute(self, value, other=False):
        self._ownedAttribute.append(value)
        if other:
            value.set_class_(self, False)
    def del_ownedAttribute(self, value, other=True):
        self._ownedAttribute.remove(value)
        if other:
            value.del_class_(self, False)
    ownedAttribute = property(get_ownedAttribute)

    def get_ownedOperation(self):
        return self._ownedOperation
    def add_ownedOperation(self, value, other=False):
        self._ownedOperation.append(value)
        if other:
            value.set_class_(self, False)
    def del_ownedOperation(self, value, other=True):
        self._ownedOperation.remove(value)
        if other:
            value.del_class_(self, False)
    ownedOperation = property(get_ownedOperation)

    def get_superClass(self):
        return self._superClass
    def set_superClass(self, val):
        self._superClass = val
    def add_superClass(self, val):
        self._superClass.append(val)
    superClass = property(get_superClass, set_superClass)


class Operation(MultiplicityElement):

    _id = 0
    isRoot = True

    def __init__(self, raisedException=None, ownedParameter=None, class_=None, isOrdered=False, isUnique=False, lower=None, upper=None, type=None, name=None, ownedComment=None, tag=None):
        super(Operation, self).__init__()
        Operation._id += 1
        self._xmi_id = 'Operation:%s' % Operation._id
        if not raisedException:
            raisedException = list()
        self._raisedException = raisedException
        if not ownedParameter:
            ownedParameter = list_composite()
        self._ownedParameter = ownedParameter
        self._class_ = class_
        self._isOrdered = isOrdered
        self._isUnique = isUnique
        self._lower = lower
        self._upper = upper
        self._type = type
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.raisedException == other.raisedException and self.ownedParameter == other.ownedParameter and self.class_ == other.class_ and self.isOrdered == other.isOrdered and self.isUnique == other.isUnique and self.lower == other.lower and self.upper == other.upper and self.type == other.type and self.name == other.name
        del self.visited
        return res    

    def get_raisedException(self):
        return self._raisedException
    def set_raisedException(self, val):
        self._raisedException = val
    def add_raisedException(self, val):
        self._raisedException.append(val)
    raisedException = property(get_raisedException, set_raisedException)

    def get_ownedParameter(self):
        return self._ownedParameter
    def add_ownedParameter(self, value, other=False):
        self._ownedParameter.append(value)
        if other:
            value.add_operation(self, False)
    def del_ownedParameter(self, value, other=True):
        self._ownedParameter.remove(value)
        if other:
            value.del_operation(self, False)
    ownedParameter = property(get_ownedParameter)

    def get_class_(self):
        return self._class_
    def set_class_(self, value, other=False):
        self._class_ = value
        if other:
            value.add_ownedOperation(self, False)
    def del_class_(self, other=True):
        if other and self._class_:
            self._class_.del_ownedOperation(self, False)
        self._class_ = None
    class_ = property(get_class_, set_class_)


class Parameter(MultiplicityElement):

    _id = 0
    isRoot = True

    def __init__(self, operation=None, isOrdered=False, isUnique=False, lower=None, upper=None, type=None, name=None, ownedComment=None, tag=None):
        super(Parameter, self).__init__()
        Parameter._id += 1
        self._xmi_id = 'Parameter:%s' % Parameter._id
        if not operation:
            operation = list()
        self._operation = operation
        self._isOrdered = isOrdered
        self._isUnique = isUnique
        self._lower = lower
        self._upper = upper
        self._type = type
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag
        
    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.operation == other.operation and self.isOrdered == other.isOrdered and self.isUnique == other.isUnique and self.lower == other.lower and self.upper == other.upper and self.type == other.type and self.name == other.name
        del self.visited
        return res    

    def get_operation(self):
        return self._operation
    def set_operation(self, value, other=False):
        self._operation = value
        if other:
            value.add_ownedParameter(self, False)
    def del_operation(self, value, other=True):
        self._operation.remove(value)
        if other:
            value.del_ownedParameter(self, False)
    operation = property(get_operation, set_operation)


class Property(MultiplicityElement):

    _id = 0
    isRoot = True

    def __init__(self, isReadOnly=False, default=None, isComposite=False, isDerived=False, isId=None, opposite=None, class_=None, isOrdered=False, isUnique=False, lower=None, upper=None, type=None, name=None, ownedComment=None, tag=None):
        super(Property, self).__init__()
        Property._id += 1
        self._xmi_id = 'Property:%s' % Property._id
        self._isReadOnly = isReadOnly
        self._default = default
        self._isComposite = isComposite
        self._isDerived = isDerived
        self._isId = isId
        self._opposite = opposite
        self._class_ = class_
        self._isOrdered = isOrdered
        self._isUnique = isUnique
        self._lower = lower
        self._upper = upper
        self._type = type
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.isReadOnly == other.isReadOnly and self.default == other.default and self.isComposite == other.isComposite and self.isDerived == other.isDerived and self.isId == other.isId and self.opposite == other.opposite and self.class_ == other.class_ and self.isOrdered == other.isOrdered and self.isUnique == other.isUnique and self.lower == other.lower and self.upper == other.upper and self.type == other.type and self.name == other.name
        del self.visited
        return res    

    def get_isReadOnly(self):
        return self._isReadOnly
    def set_isReadOnly(self, value):
        self._isReadOnly = value
    isReadOnly = property(get_isReadOnly, set_isReadOnly)

    def get_default(self):
        return self._default
    def set_default(self, value):
        self._default = value
    default = property(get_default, set_default)

    def get_isComposite(self):
        return self._isComposite
    def set_isComposite(self, value):
        self._isComposite = value
    isComposite = property(get_isComposite, set_isComposite)

    def get_isDerived(self):
        return self._isDerived
    def set_isDerived(self, value):
        self._isDerived = value
    isDerived = property(get_isDerived, set_isDerived)

    def get_isId(self):
        return self._isId
    def set_isId(self, value):
        self._isId = value
    isId = property(get_isId, set_isId)

    def get_opposite(self):
        return self._opposite
    def set_opposite(self, value):
        self._opposite = value
    opposite = property(get_opposite, set_opposite)

    def get_class_(self):
        return self._class_
    def set_class_(self, value, other=False):
        self._class_ = value
        if other:
            value.add_ownedAttribute(self, False)
    def del_class_(self, other=True):
        if other and self._class_:
            self._class_.del_ownedAttribute(self, False)
        self._class_ = None
    class_ = property(get_class_, set_class_)


class Enumeration(DataType):

    _id = 0
    isRoot = True

    def __init__(self, ownedLiteral=None, package=None, name=None, ownedComment=None, tag=None):
        super(Enumeration, self).__init__()
        Enumeration._id += 1
        self._xmi_id = 'Enumeration:%s' % Enumeration._id
        if not ownedLiteral:
            ownedLiteral = list_composite()
        self._ownedLiteral = ownedLiteral
        self._package = package
        self._name = name
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.ownedLiteral == other.ownedLiteral and self.name == other.name
        del self.visited
        return res    

    def get_ownedLiteral(self):
        return self._ownedLiteral
    def add_ownedLiteral(self, value, other=False):
        self._ownedLiteral.append(value)
        if other:
            value.set_enumeration(self, False)
    def del_ownedLiteral(self, value, other=True):
        self._ownedLiteral.remove(value)
        if other:
            value.del_enumeration(self, False)
    ownedLiteral = property(get_ownedLiteral)


class PrimitiveType(DataType):

    _id = 0
    isRoot = True

    def __init__(self, name=None, package=None, ownedComment=None, tag=None):
        super(PrimitiveType, self).__init__()
        PrimitiveType._id += 1
        self._xmi_id = 'PrimitiveType:%s' % PrimitiveType._id
        self._name = name
        self._package = package
        if not ownedComment:
            ownedComment = list()
        self._ownedComment = ownedComment
        if not tag:
            tag = list()
        self._tag = tag

    def __eq__(self, other):
        if hasattr(self, 'visited'):
            return True
        if type(self) != type(other):
            return False
        self.visited = None
        res = self.name == other.name
        del self.visited
        return res    


class Integer(object):

    _id = 0
    isRoot = True

    def __init__(self, ):
        super(Integer, self).__init__()
        Integer._id += 1
        self._xmi_id = 'Integer:%s' % Integer._id
        self._name = 'Integer'
        
    def get_id(self):
        return self._xmi_id
    id = property(get_id)

    def get_name(self):
        return self._name
    name = property(get_name)
    
class Boolean(object):

    _id = 0
    isRoot = True

    def __init__(self, ):
        super(Boolean, self).__init__()
        Boolean._id += 1
        self._xmi_id = 'Boolean:%s' % Boolean._id
        self._name = 'Boolean'
    
    def get_id(self):
        return self._xmi_id
    id = property(get_id)

    def get_name(self):
        return self._name
    name = property(get_name)
    
class String(object):

    _id = 0
    isRoot = True

    def __init__(self, ):
        super(String, self).__init__()
        String._id += 1
        self._xmi_id = 'String:%s' % String._id
        self._name = 'String'

    def get_id(self):
        return self._xmi_id
    id = property(get_id)
    
    def get_name(self):
        return self._name
    name = property(get_name)
    


class UnlimitedNatural(object):

    _id = 0
    isRoot = True

    def __init__(self, ):
        super(UnlimitedNatural, self).__init__()
        UnlimitedNatural._id += 1
        self._xmi_id = 'UnlimitedNatural:%s' % UnlimitedNatural._id
        self._name = 'UnlimitedNatural'

    def get_id(self):
        return self._xmi_id
    id = property(get_id)

    def get_name(self):
        return self._name
    name = property(get_name)
    
class Repository(object):

    def __init__(self):
        super(Repository, self).__init__()
        
        self._Class = list()
        self._Operation = list()
        self._Parameter = list()
        self._Property = list()
        
        self._Enumeration = list()
        self._EnumerationLiteral = list()
        self._PrimitiveType = list()
        
        self._Tag = list()
        
        self._Package = list()
        
        self._Comment = list()
        
        self._Element = list()

    def get_Class(self):
        return self._Class
    def add_Class(self, val):
        self._Class.append(val)
    Class = property(get_Class)

    def get_Operation(self):
        return self._Operation
    def add_Operation(self, val):
        self._Operation.append(val)
    Operation = property(get_Operation)

    def get_Parameter(self):
        return self._Parameter
    def add_Parameter(self, val):
        self._Parameter.append(val)
    Parameter = property(get_Parameter)

    def get_Property(self):
        return self._Property
    def add_Property(self, val):
        self._Property.append(val)
    Property = property(get_Property)
    
    

    def get_Enumeration(self):
        return self._Enumeration
    def add_Enumeration(self, val):
        self._Enumeration.append(val)
    Enumeration = property(get_Enumeration)

    def get_EnumerationLiteral(self):
        return self._EnumerationLiteral
    def add_EnumerationLiteral(self, val):
        self._EnumerationLiteral.append(val)
    EnumerationLiteral = property(get_EnumerationLiteral)

    def get_PrimitiveType(self):
        return self._PrimitiveType
    def add_PrimitiveType(self, val):
        self._PrimitiveType.append(val)
    PrimitiveType = property(get_PrimitiveType)

    
    
    def get_Tag(self):
        return self._Tag
    def add_Tag(self, val):
        self._Tag.append(val)
    Tag = property(get_Tag)



    def get_Package(self):
        return self._Package
    def add_Package(self, val):
        self._Package.append(val)
    Package = property(get_Package)
    
    

    def get_Comment(self):
        return self._Comment
    def add_Comment(self, val):
        self._Comment.append(val)
    Comment = property(get_Comment)
    
    
    
    def get_Element(self):
        return self._Element
    def add_Element(self, val):
        self._Element.append(val)
    Element = property(get_Element)
    
    def findClass(self, id):
        for o in self.Class:
            if o._xmi_id == id:
                return o
        
        return None
    
    def findOperation(self, id):
        for o in self.Operation:
            if o._xmi_id == id:
                return o
        
        return None
    
    def findParameter(self, id):
        for o in self.Parameter:
            if o._xmi_id == id:
                return o
        
        return None
    
    def findProperty(self, id):
        for o in self.Property:
            if o._xmi_id == id:
                return o
        
        return None
    
    def findEnumeration(self, id):
        for o in self.Enumeration:
            if o._xmi_id == id:
                return o
        
        return None

    def findEnumerationLiteral(self, id):
        for o in self.EnumerationLiteral:
            if o._xmi_id == id:
                return o
        
        return None

    def findPrimitiveType(self, id):
        for o in self.PrimitiveType:
            if o._xmi_id == id:
                return o
        
        return None
    
    def findTag(self, id):
        for o in self.Tag:
            if o._xmi_id == id:
                return o
        
        return None
    
    def findPackage(self, id):
        for o in self.Package:
            if o._xmi_id == id:
                return o
        
        return None
    
    def findComment(self, id):
        for o in self.Comment:
            if o._xmi_id == id:
                return o
        
        return None
    
    def findElement(self, id):
        for pt in self.PrimitiveType:
            if pt._xmi_id == id:
                return pt
            
        for enum in self.Enumeration:
            if enum._xmi_id == id:
                return enum
                
        for clss in self.Class:
            if clss._xmi_id == id:
                return clss
        
        for pkg in self.Package:
            if pkg._xmi_id == id:
                return pkg
        
        for op in self.Operation:
            if op._xmi_id == id:
                return op
        
        for pa in self.Parameter:
            if pa._xmi_id == id:
                return pa
        
        for pr in self.Property:
            if pr._xmi_id == id:
                return pr
        
        for el in self.EnumerationLiteral:
            if el._xmi_id == id:
                return el    
        
        for tg in self.Tag:
            if tg._xmi_id == id:
                return tg
        
        for cm in self.Comment:
            if cm._xmi_id == id:
                return cm
            
        return None
    
    def findType(self, id):
        for pt in self.PrimitiveType:
            if pt._xmi_id == id:
                return pt
            
        for enum in self.Enumeration:
            if enum._xmi_id == id:
                return enum
            
        for clss in self.Class:
            if clss._xmi_id == id:
                return clss
        
        return None        
    

class Factory(object):

    def __init__(self, repository):
        super(Factory, self).__init__()
        self._repository = repository


    def create_Class(self):
        o = Class()
        self._repository.Class.append(o)
        return o

    def create_Operation(self):
        o = Operation()
        self._repository.Operation.append(o)
        return o

    def create_Parameter(self):
        o = Parameter()
        self._repository.Parameter.append(o)
        return o

    def create_Property(self):
        o = Property()
        self._repository.Property.append(o)
        return o

    
    def create_Enumeration(self):
        o = Enumeration()
        self._repository.Enumeration.append(o)
        return o

    def create_EnumerationLiteral(self):
        o = EnumerationLiteral()
        self._repository.EnumerationLiteral.append(o)
        return o

    def create_PrimitiveType(self):
        o = PrimitiveType()
        self._repository.PrimitiveType.append(o)
        return o
    

    def create_Tag(self):
        o = Tag()
        self._repository.Tag.append(o)
        return o
    

    def create_Package(self):
        o = Package()
        self._repository.Package.append(o)
        return o


    def create_Comment(self):
        o = Comment()
        self._repository.Comment.append(o)
        return o

    def create_Integer(self):
        o = Integer()
        self._repository.PrimitiveType.append(o)
        return o

    def create_Boolean(self):
        o = Boolean()
        self._repository.PrimitiveType.append(o)
        return o

    def create_String(self):
        o = String()
        self._repository.PrimitiveType.append(o)
        return o

    def create_UnlimitedNatural(self):
        o = UnlimitedNatural()
        self._repository.PrimitiveType.append(o)
        return o

# eof
